<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0,
    maximum-scale=1.0,minimum-scale=1.0,user-scalable=0">
    <title>swiper轮播</title>
    <link rel="shortcut icon" href="./img/favicon.jpg" type="image/x-icon">
    <link rel="stylesheet" href="./css/common.css">
    <link rel="stylesheet" href="./css/swiper-bundle.min.css">
    <style>
        .swiper-container {
            width: 3rem;
            height: 1.5rem;
        }

        .swiper-container img {
            display: block;
            width: 100%;
        }

        /* 媒体查询：w<=750px */
        @media all and (max-width:750px) {
            .swiper-container {
                width: 100%;
                /* img:w=300;h=150
                100vw/h=300/150
                h=100vw/2 */
                height: calc(100vw/2);
            }
        }
    </style>
</head>

<body>
    <div class="app"></div>
    <!-- 轮播图 -->
    <div class="swiper-container">
        <div class="swiper-wrapper">
            <div class="swiper-slide"><img src="./img/01.jpg" alt=""></div>
            <div class="swiper-slide"><img src="./img/02.jpeg" alt=""></div>
            <div class="swiper-slide"><img src="./img/03.jpeg" alt=""></div>
            <div class="swiper-slide"><img src="./img/04.jpeg" alt=""></div>
            <div class="swiper-slide"><img src="./img/05.jpeg" alt=""></div>
            <div class="swiper-slide"><img src="./img/06.jpeg" alt=""></div>
            <div class="swiper-slide"><img src="./img/07.jpeg" alt=""></div>
            <div class="swiper-slide"><img src="./img/08.jpeg" alt=""></div>
        </div>
        <!-- 如果需要分页器 -->
        <div class="swiper-pagination"></div>

        <!-- 如果需要导航按钮 -->
        <!-- <div class="swiper-button-prev"></div>
        <div class="swiper-button-next"></div> -->

        <!-- 如果需要滚动条  -->
        <!-- <div class="swiper-scrollbar"></div> -->
    </div>
    <script src="./js/swiper-bundle.min.js"></script>
    <script src="./js/rem.js"></script>
    <script>
        let sp = new Swiper('.swiper-container', {
            direction: 'horizontal',
            autoplay: {
                delay: 3000,
                stopOnLastSlide: false,
                disableOnInteraction: false,
            },
            loop: true,
            pagination: {
                el: '.swiper-pagination',
                clickable: true,
            },
            
            // effect: 'flip',
            // flipEffect: {
            //     slideShadows: true,
            //     limitRotation: true,
            // }
        })
        // 鼠标的悬停切换
        for (i = 0; i < sp.pagination.bullets.length; i++) {
            sp.pagination.bullets[i].onmouseover = function () {
                this.click()
            }
        }
    </script>
</body>

</html>